<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .item {
            background-color: black;
        }

        .success {
            color: green
        }
    </style>
</head>

<body>
    <div id="app">

        <div style="background-color: red;color: black;">测试style</div>
        <div :style="mystyle1">测试style</div>
        <div :style="{backgroundColor:bgColor,color:color}">测试style</div>
        <div :style="mystyle2">测试style</div>
        <button @click="update">修改</button>

    </div>
</body>
<script>
    new Vue({
        el: "#app",
        data: {
            mystyle1:"background-color: red;color: black",
            bgColor:"red",
            color:"black",
            mystyle2:{
                backgroundColor:"yellow",
                color:"red"
            }
        },
        methods: {
            update(){
               // this.mystyle1 = "background-color: red;color: white";
                this.color = "white";
                this.mystyle2.color= "white";
            }
        },
    })
</script>

</html>